#version 450 core

layout(location = 0) in vec3 positionOS;

layout(std140, binding = 0) uniform PerDraw
{
    mat4 viewMatrix;
    mat4 projMatrix;
} perDraw;

out Varyings
{
    vec3 positionWS;
} o;

void main()
{
    o.positionWS = positionOS;
    // 去掉T列，只保留旋转
    mat4 R = mat4(perDraw.viewMatrix[0], perDraw.viewMatrix[1], perDraw.viewMatrix[2], vec4(0.0, 0.0, 0.0, 1.0));
    vec4 positionCS = perDraw.projMatrix * R * vec4(positionOS, 1.0);
    gl_Position = positionCS.xyww;
}
